<?php
/**
 * 静态类,储存数据库连接池
 *
 */
class Lib_Pool{
	public static $pool = array();
	
	public static function get_connect($db_conf){
		$connect_key = md5(serialize($db_conf['dsn']));
		if (!is_object(self::$pool[$connect_key])) {
/*			debug_print_backtrace();
			echo "<pre>";
			var_dump($db_conf);
			echo "</pre>";*/
			self::$pool[$connect_key] = new Lib_Pdo( $db_conf['dsn'], $db_conf['username'], $db_conf['password'], $db_conf['driver_option'] );
			self::$pool[$connect_key]->set_names( 'UTF8' );
		}
		$link = &self::$pool[$connect_key];
		return $link;
	}
}